<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'content.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="js/jquery.js"></script>
  <script type="text/javascript">
   <!--
      function getMessage(){
        $.ajax({
               type:"POST",
               url:"changeInfo_getMessage.action",
               dataType:"xml",
               success:messageBack
        });
      }
    function messageBack(data){
    
       $(data).find('message').each(
          function() {
          var id=$(this).find("id").text();
          var name=$(this).find("sender").text();
          var message=$(this).find("content").text();
          //var content=document.getElementById("content");
          //content.innerHTML=message;
          var f=true;
          var d=$("#content").children();
         /* while(d.length !=0){
           if(d.attr("id")==id){
              f=false;
              break ;
            }
          te=te.next();
       }*/
    
       if(f){
         var str="<div id='"+id+"'>发送者："+name+"</div>"
         str+="<hr><div >内容："+message+"</div></div>";
         $("#content").append(str);
       // content.innerHTML=message;
       }
          }
       );
    }
    window.setInterval(getMessage,700);
   //-->
 </script>
  </head>
  
  <body>
  
   <table border="1" width="100%">
   
     <tr>
       <td id="content"></td>
     </tr>
   </table>
   <!--

   <s:form action="changeInfo_changeInfo">
     <s:hidden name="reciverId" value=""></s:hidden>
     <s:textarea name="msg" cols="15" rows="20" label="内容"></s:textarea>
     <s:submit value="提交"></s:submit>
     <s:reset value="重置"></s:reset>
   </s:form>
   
  -->
  <form action="changeInfo_changeInfo.action" method="post">
    <input type="hidden"name="reciverId" value="<%=request.getParameter("reciverId") %>" /><br>
    <textarea name="msg" id="msg" cols="45" rows="5"></textarea>
    <input type="submit" value="提交">
  </form>
  </body>
</html>
